<%@ page import="java.util.*,com.db.tracker.vo.*,java.util.*,com.db.tracker.util.*,java.text.*,java.io.*"%>
<%@ page import="com.db.tracker.vo.ReleaseVO"%>
<%@ page import="com.release.utils.PropertyManager"%>
<%@ page import="com.release.utils.GlobalPropertyManager"%>
<%@ page session = "true" %>
<%try {
				
				session = request.getSession();
			//	System.out.println("user_id..main"+ session.getAttribute("USER_ID"));

			PropertyManager objPropertyManager=null;
					objPropertyManager = GlobalPropertyManager.get();

//	temporary removed, enable this line for login, and remove if(false){
 			if (session.getAttribute("USER_ID") == null || !((String) session.getAttribute("SESSION_ID")).equals(session.getId())) {
//			if(false){	
					try {
						response.sendRedirect("LoginPage.jsp");
					} catch (IOException ioe) {
						ioe.printStackTrace();
					}

				} else { 
					
					
					String userid = (String)session.getAttribute("USER_ID")==null?"":(String)session.getAttribute("USER_ID");
			//		userid = "ronaksureshbhai.patel@cgi.com";


					Properties property1 = new Properties();
					//File propfile1 = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
					//File propfile1 = new File("STtracker.properties");
					//InputStream in1 = new FileInputStream(propfile1);
					
					//property1.load(in1);
					String defaultunixserver;
					defaultunixserver = objPropertyManager.getPropertyValue("ReleaseUnixServer");	
					
				

					DBUtil dbutil = new DBUtil();
					UnixUtil unixutil = new UnixUtil();
					Vector instream = null;
					
					Vector relNameVector = new Vector();
					relNameVector = (Vector)session.getAttribute("OPEN-REL-NAME-VECTOR");
					
					if(relNameVector == null){
						relNameVector = dbutil.getAllReleaseName();
						if(relNameVector.size()>0){
							session.removeAttribute("OPEN-REL-NAME-VECTOR");
							session.setAttribute("OPEN-REL-NAME-VECTOR",relNameVector);
						}
					}
					Vector dbavector = new Vector();
					Vector logFileVector = new Vector();
					String releaseName = (String)request.getParameter("releaseName")==null?(request.getParameter("hiddenrelname")==null?"":request.getParameter("hiddenrelname")):request.getParameter("releaseName");

					
					String execshellbutton = request.getParameter("Act")==null?"":request.getParameter("Act");
			//		System.out.println(">>>>>> execshellbutton :"+execshellbutton);

					String getreport = (String)request.getParameter("getreportbutton")==null?"":request.getParameter("getreportbutton");
					String getdocbutton = (String)request.getParameter("getdocbutton")==null?"":request.getParameter("getdocbutton");
					String dbabutton = (String)request.getParameter("dbabutton")==null?"":request.getParameter("dbabutton");
					String filterreportbutton = (String)request.getParameter("filterreportbutton")==null?"":request.getParameter("filterreportbutton");

					String ftr_dbname = (String)request.getParameter("ftr_dbname")==null?"0":request.getParameter("ftr_dbname");
					String ftr_objtype = (String)request.getParameter("ftr_objtype")==null?"0":request.getParameter("ftr_objtype");
					String ftr_user = (String)request.getParameter("ftr_user")==null?"0":request.getParameter("ftr_user");
					String filterAction = (String)request.getParameter("filterAction")==null?"":request.getParameter("filterAction");
					String goforreleasebutton = (String)request.getParameter("goforreleasebutton")==null?"":request.getParameter("goforreleasebutton");

					String unixServerForRel = (String)request.getParameter("unixServerForRel")==null?defaultunixserver:request.getParameter("unixServerForRel");
					String unixServerUserid = (String)request.getParameter("unixServerUserid")==null?"":request.getParameter("unixServerUserid");
					String unixServerPwd = (String)request.getParameter("unixServerPwd")==null?"":request.getParameter("unixServerPwd");
					
					String getlogbutton = (String)request.getParameter("Act")==null?"":request.getParameter("Act");		
				    String downloadlogfilebutton = (String)request.getParameter("downloadlogfilebutton")==null?"":request.getParameter("downloadlogfilebutton");

					String downloadlogfile = (String)request.getParameter("downloadlogfile")==null?"":request.getParameter("downloadlogfile");

					Vector ReleaseReportVector = null;
					Vector ReleaseDocVector = null;
					Vector FilterVector = null;

					boolean releaserightflag = false;
					releaserightflag = dbutil.checkUserRightForRelease(userid);



					if(getreport.equals("Get Report")){
					ReleaseReportVector = dbutil.getReleaseReport(releaseName);
					
					}

					if(dbabutton.equals("Get DBA Report")){
						dbavector = dbutil.getDBAReport(releaseName);
						session.removeAttribute("RELEASE_DBA_REPORT");
						if(dbavector!=null){
							session.setAttribute("RELEASE_DBA_REPORT", dbavector);
						}
					}



					  if(downloadlogfilebutton.equals("Get File")){
	 						
							Properties property = new Properties();
							//File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
							//InputStream in = new FileInputStream(propfile);
							//property.load(in);
							String logFilePath;
							logFilePath = objPropertyManager.getPropertyValue("ReleaseLogFilePath");	

							response.setContentType("application");
							response.setHeader("Content-disposition","attachment; filename=" + downloadlogfile );
  							System.out.println(">>>> user to download"+unixServerUserid);
							String logdirpath = logFilePath+"/"+releaseName;
							System.out.println("while downloading file"+logdirpath);
							unixutil.downLoadFile( unixServerForRel, unixServerUserid, unixServerPwd, logdirpath, downloadlogfile, response.getOutputStream());
							response.flushBuffer();
							//	response.sendRedirect("/sl/reports/downLoadFileToSys.jsp");
							//	return;
						}
				


					if(execshellbutton.equals("Execute Shell for Release")){
					
						boolean successflag = false;
				//		successflag = dbutil.createBackEndTableForRelease(releaseName);
						String unixserver;
						String unixlogin;
						String unixpwd;
						String unixcommand;
						/////

					//	Properties property = new Properties();
					//	File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
					//	InputStream in = new FileInputStream(propfile);
					//	property.load(in);

				//		unixserver = property.getProperty("ReleaseUnixServer");
				//		unixlogin = property.getProperty("ReleaseUnixLogin");
				//		unixpwd = property.getProperty("ReleaseUnixPwd");
						unixcommand =objPropertyManager.getPropertyValue("ReleaseUnixCommand");

						////
						boolean execflag = false;
						try{
						unixcommand = unixcommand+" '"+releaseName+"'";
						System.out.println("unixcommand which get execute :"+unixcommand);
						execflag = unixutil.ExecuteUnixShellForRelease(unixServerForRel, unixServerUserid, unixServerPwd, unixcommand, releaseName);
						}catch(Exception e){
						System.out.println("Exception for waiting long time :"+e);
						}



						

						if(execflag == true){
						
							  %>
					  	<script>
							alert("Release Shell execution has been started. You can see log by clicking on 'Get Log for Release'. ");
						</script>
					  
					  <%
					
						}else{
						
						  %>
					  	<script>
							alert("Not able to execute Shell, Please make sure that unix server, user and password are correct.");
						</script>
					 	  <%


						}
						
					



					}

					if(getlogbutton.equals("Get Log for Release")){
					
						//Properties property = new Properties();
						//File propfile = new File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
						//InputStream in = new FileInputStream(propfile);
						//property.load(in);
						String logFilePath;
						logFilePath = objPropertyManager.getPropertyValue("ReleaseLogFilePath");	
						logFilePath = logFilePath + "/" + releaseName;
						logFileVector = unixutil.getFilesInfo(unixServerForRel, unixServerUserid, unixServerPwd, logFilePath);
					
					}





					if(getdocbutton.equals("Get Documents")){
					
					ReleaseDocVector = dbutil.getReleaseDocumentLinks(releaseName);

				//	System.out.println(">>>>>>>>>>>>>>releasename"+releaseName);
				//	System.out.println(">>>>>>>>>>>>>>releasename"+ReleaseDocVector.size());

										
					}

					if(filterreportbutton.equals("Get Filter Report") || filterAction.equals("FilterAction") ){
					
					FilterVector = dbutil.getFilterReport(releaseName, ftr_dbname, ftr_objtype, ftr_user);
					session.removeAttribute("RELEASE_FILTER_REPORT");
					
					if(FilterVector!=null){
					
						session.setAttribute("RELEASE_FILTER_REPORT", FilterVector);
					
						}
					
					
					}


					%>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="styles/tracker_style.css">
		<title>
			Release Reports
		</title>
		<script>

			function checkForRelease(obj){
			
			 if( obj.value == 0){
					alert("Kindly select Release Name from the list.");
					obj.focus();
					return false;
				 }

				 document.searchReleaseReport.action="ReleaseReport.do";
				 document.searchReleaseReport.submit();
				
			}

			function exportToExcelForCR(relName)
				{
					document.FilterReportDisplayForm.action = "ExportToExcelForCRNotes.jsp";	
					document.FilterReportDisplayForm.submit();
					document.FilterReportDisplayForm.action = "ReleaseReport.jsp";
			 	}
				
			function submitThisForReport()
				{
					document.searchReleaseReport.releaseName.value = document.FilterReportDisplayForm.hiddenrelname.value
					document.searchReleaseReport.filterreportbutton.value = "Get Filter Report";
					document.searchReleaseReport.submit();
					document.FilterReportDisplayForm.submit();
				}

			function exportToExcelForFilter()
				{
					document.FilterReportDisplayForm.action = "ExportToExcelForFilter.jsp";	
					document.FilterReportDisplayForm.submit();
					document.FilterReportDisplayForm.action = "ReleaseReport.jsp";
				}
			function exportToExcelForDBA()
				{
					document.ReleaseDBAReportDisplay.action = "ExportToExcelForDBA.jsp";	
					document.ReleaseDBAReportDisplay.submit();
					document.ReleaseDBAReportDisplay.action = "ReleaseReport.jsp";
				}	


			function trim(sString)
				  {
					sTrimmedString = "";
				    if (sString != "") {
					  var iStart = 0;
					  var iEnd = sString.length - 1;
					  // var sWhitespace = " \t\f\n\r\v";
					  var sWhitespace = "   ";
		
		
					  while (sWhitespace.indexOf(sString.charAt(iStart)) != -1) {
						 iStart++;
						 if (iStart > iEnd) 
							break;
					  }

					  // If the string not just whitespace
					  if (iStart <= iEnd) {
						 while (sWhitespace.indexOf(sString.charAt(iEnd)) != -1)
							iEnd--;
							 sTrimmedString = sString.substring(iStart,++iEnd);
						  }
					   }
				   return sTrimmedString;
				 }

		  function checkforempty()
			{
			
				document.ReleaseExecuteForm.unixServerForRel.value =trim(document.ReleaseExecuteForm.unixServerForRel.value);
				document.ReleaseExecuteForm.unixServerUserid.value =trim(document.ReleaseExecuteForm.unixServerUserid.value);
				document.ReleaseExecuteForm.unixServerPwd.value =trim(document.ReleaseExecuteForm.unixServerPwd.value);
			
			
				if(submitForms(document.ReleaseExecuteForm.unixServerForRel, document.ReleaseExecuteForm.unixServerUserid, document.ReleaseExecuteForm.unixServerPwd))
				{
					document.ReleaseExecuteForm.Act.value = "Execute Shell for Release";
					document.ReleaseExecuteForm.submit();
				}
				
			}


			function checkforempty2()
			{
			
				document.ReleaseExecuteForm.unixServerForRel.value =trim(document.ReleaseExecuteForm.unixServerForRel.value);
				document.ReleaseExecuteForm.unixServerUserid.value =trim(document.ReleaseExecuteForm.unixServerUserid.value);
				document.ReleaseExecuteForm.unixServerPwd.value =trim(document.ReleaseExecuteForm.unixServerPwd.value);
			
			
				if(submitForms(document.ReleaseExecuteForm.unixServerForRel, document.ReleaseExecuteForm.unixServerUserid, document.ReleaseExecuteForm.unixServerPwd))
				{
					document.ReleaseExecuteForm.Act.value = "Get Log for Release";
					document.ReleaseExecuteForm.submit();
				}
				
			}


			function submitForms(obj1, obj2, obj3){
	
			    if (obj1.value.length == 0 ){
					alert("Please enter unix server name.");
					obj1.focus();
					return false;
				 }

				 if( obj2.value.length == 0){
					alert("Please enter unix server userid.");
					obj2.focus();
					return false;
				 }

				 if( obj3.value.length == 0){
					alert("Please enter unix server password.");
					obj3.focus();
					return false;
				}
			
				return true;
				//  document.updateRelease.submit();
				//  document.searchReleaseForm.submit();
	
				//document.displayForm.submit();
		  	
		  				//  document.MainForm.submit();
						//alert("HIIIIIII");
			}
		
		function overviewCRDetails(ReleaseObjKey) {
			dwin=window.open("OverviewCRDetail.jsp?relobjkey="+ReleaseObjKey,"detailWin","width=900,height=600,scrollbars=yes,resizable=yes");
			dwin.focus();
		
		}
		</script>
	</head>

	<body>
		
		<form name="ReleaseReport" method="post">


			
			<table width=100%>
				<tr>
					<td width=100%>
						<jsp:include page="HeaderNav_ReleaseObject.jsp" />
					</td>
				</tr>
			</table>
			</form>




		<a href="mainpage.jsp">Back to Main Page.</a>
		
		<form name="searchReleaseReport" action="ReleaseReport.jsp" method="post">
		
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid">
				<tr bgcolor=#EFEFEF>
					<td class=bodyblue>
						<b>
							Release Name
						</b>
					</td>

					<td class=bodyblue>
						<select name=releaseName>

							 <option value='0' <% out.println("selected");%>>
								Select Release
							</option>
						
							<%for (int i = 0; i < relNameVector.size(); i++) {
						ReleaseVO relbean = (ReleaseVO) relNameVector
								.elementAt(i);

						%>

							<option value='<%=	relbean.getReleaseName()%>' <%= releaseName.equals(relbean.getReleaseName())?"selected":""%>>
								<%=relbean.getReleaseName()%>
							</option>

							<%}

					%>
						</select>
					</td>


					<!--
					<td>
						<input type=submit class=whitebutton name=getreportbutton value="Get Report" onclick="return checkForRelease(releaseName)">
					</td>
					-->


					<td>
						<input type=submit class=whitebutton name="filterreportbutton" value="Get Filter Report" onclick="return checkForRelease(releaseName)">
					</td>
					
					<td>
						<input type=submit class=whitebutton name=getdocbutton value="Get Documents" onclick="return checkForRelease(releaseName)">
					</td>
					
			<!--	<td>
						<input type=submit class=whitebutton name=getcrnotebutton value="Get CR Rel Notes" onclick="exportToExcelForCR(releaseName)">						
					</td>
			-->
					<td>
						<input type=submit class=whitebutton name="dbabutton" value="Get DBA Report" onclick="return checkForRelease(releaseName)">
					</td>

					<%	if(releaserightflag == true){	%>
					<td>
						<input type=submit class=whitebutton name="goforreleasebutton" value="Go for Release" onclick="return checkForRelease(releaseName)">
					</td>
					<% }	%>
				</tr>
			</table>
		</form>

		<%
		if(getreport.equals("Get Report")){		
		%>
		<form name="ReleaseReportDisplay" action="ReleaseReport.jsp" method="post">
		
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid">
			
					<%
					 if(ReleaseReportVector != null && ReleaseReportVector.size()>0) {
					 for (int i=0;i<ReleaseReportVector.size();i++){	
						 String displaystr = (String)ReleaseReportVector.elementAt(i);

					%>
					<tr bgcolor=#EFEFEF>		
					<td class=bodyblue>						
							<% if(displaystr.trim().equals("")){ %>&nbsp<%}else{%>
							<%=displaystr%>
							<%}%>
					</td>
					</tr>
				<% }}else{ %>	
					<tr bgcolor="#000077" >
						<td class=smallfonthead colspan=1 width="100%">
							<b>
								Objects not available for selected Release.
							</b>
						</td>
					</tr>						
					
				<%}%>
				
			</table>
		</form>

		<% }

/////

		
	if(dbabutton.equals("Get DBA Report")){
		%>
		<form name="ReleaseDBAReportDisplay" action="ReleaseReport.jsp" method="post">
		
			<table width="100%">
				<tr width="100%">
					<td align="right">
						<input type=button class=whitebutton name="exportdbabutton"  value="Export to Excel" onclick="exportToExcelForDBA()">
					</td>
				</tr>
			</table>

			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid" colspan=4>
			
					<%
					 if(dbavector != null && dbavector.size()>0) {
					 %>	
						<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=1 width="5%">
								<b>
									#
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="15%">
								<b>
									Object Type
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="15%">
								<b>
									Database Name
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="65%">
								<b>
									Object Name
								</b>
							</td>
						</tr>	
					 <%
                     String objectnamedisplay = "";
					 String prevobjname = "";
					 int srno = 0;
					 for (int i=0;i<dbavector.size();i++){	
						 ReleaseVO relvo = (ReleaseVO)dbavector.elementAt(i);
						 objectnamedisplay = relvo.getObjType();
						 if(!(objectnamedisplay.equals(prevobjname))){
							 srno = 1;
					%>
						<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=4 >
								<b>
									<%= objectnamedisplay%>
								</b>
							</td>
						</tr>	
				
						<%}
						%>
						<tr bgcolor=#EFEFEF>		
							<td class=bodyblue colspan=1 align="center">
								
									<%=srno++%>
								
							</td>
							<td class=bodyblue colspan=1 align="center">
								
									<%=relvo.getObjType()%>
								
							</td>
							<td class=bodyblue colspan=1 align="left">
								
									<%=relvo.getDBName()%>
								
							</td>
							<td class=bodyblue colspan=1 align="left">
								
									<%=relvo.getObjName()%>
								
							</td>
					</tr>
				<%			prevobjname = relvo.getObjType();
					}}else{ %>	
						<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=1 width="100%">
								<b>
									No DBA Objects (New Table, New Index, Alter Statements) available for selected Release.
								</b>
							</td>
						</tr>	
					<%}%>
				
			</table>
		</form>

		<% }







	if(goforreleasebutton.equals("Go for Release") || execshellbutton.equals("Execute Shell for Release") || getlogbutton.equals("Get Log for Release")){		


		%>
		<form name="ReleaseExecuteForm" action="ReleaseReport.jsp" method="post">
		
			<table cellpadding="0" cellspacing="1" width="60%" style="BORDER:#000000 1px solid" colspan=2 align = 'center'>
			<input type=hidden name=hiddenrelname value='<%=releaseName%>'>
			<input type=hidden name=Act value='NO-Action'>
			
			<tr bgcolor="#000077" >
				<td class=smallfonthead colspan=2 >
					<b>
						Release Details
					</b>
				</td>
			</tr>
			
			<tr bgcolor="#EFEFEF" >
				<td class=bodyblue colspan=1 align='right' width='35%'>
					<b>
						Release Name &nbsp&nbsp
					</b>
				</td>
				<td class=bodyblue colspan=1 width='65%'>
					<b>
						<input type=text name=disablerelname size=40 value=<%=releaseName%> <% out.println("disabled"); %>> 
					</b>
				</td>	
			</tr>


			<tr bgcolor="#EFEFEF" >
				<td class=bodyblue colspan=1 align='right' width='35%'>
					<b>
						Unix Server Name &nbsp&nbsp
					</b>
				</td>
				<td class = bodyblue width='65%'>
					<input type=text name=unixServerForRel value='<%=unixServerForRel%>'size="40" >
				</td>	
			</tr>

			<tr bgcolor="#EFEFEF" >
				<td class=bodyblue colspan=1 align='right' width='35%'>
					<b>
						Unix Server Userid &nbsp&nbsp
					</b>
				</td>
				<td class = bodyblue width='65%'>
					<input type=text name=unixServerUserid value='<%=unixServerUserid%>' size="40" >
				</td>	
			</tr>

			<tr bgcolor="#EFEFEF" >
				<td class=bodyblue colspan=1 align='right' width='35%'>
					<b>
						Unix Server Password &nbsp&nbsp
					</b>
				</td>
				<td class = bodyblue width='65%'>
					<input type=password name=unixServerPwd value='<%=unixServerPwd%>' size="40" >
				</td>	
			</tr>
			
			<tr bgcolor="#EFEFEF" >
				<td align="right" colspan=1 >
					&nbsp
				</td>

				<td align="left" colspan=1 >
					<input type=button class=whitebutton name=execshellbutton  value="Execute Shell for Release" onclick='return checkforempty()'>
					<input type=button class=whitebutton name=getlogbutton  value="Get Log for Release" onclick='return checkforempty2()'>
				</td>

			</tr>
		</table>
	</form>

		<% }


//////

				
		if(getlogbutton.equals("Get Log for Release")){		

		
		%>
		
		
			<table cellpadding="0" cellspacing="1" width="60%" style="BORDER:#000000 1px solid" align='center'>
			
				
					<% int read=0;
					 if( logFileVector!= null) {

					%>
					<tr bgcolor="#000077" >
					<td class=smallfonthead colspan=1 width="60%">
						<b>
							Release Log File Name
						</b>
					</td>

					<td class=smallfonthead colspan=1 width="20%">
						<b>
							Date
						</b>
					</td>
		
					<td class=smallfonthead colspan=1 width="20%">
						<b>
							Actions
						</b>
					</td>
					</tr>
					<%
					//	BufferedReader br = new BufferedReader(new InputStreamReader(instream));

					//	while ((read = br.read()) != -1) {
					//		char c = (char)read;
							String displaystr1 ;
							FileBean fileBean = new FileBean();
					for(int i=0;i<logFileVector.size();i++){
						fileBean = (FileBean)logFileVector.elementAt(i);
					%>
					<form name="ReleaseLogDisplay" action="ReleaseReport.jsp" method="post">
					<tr bgcolor=#EFEFEF>		
					<td class=bodyblue ><%=fileBean.getFileName()%></td>
					<td class=bodyblue align='center'><%=fileBean.getFileDate()%></td>
					<input type='hidden' name='downloadlogfile' value='<%=fileBean.getFileName()%>'>
					<input type='hidden' name='unixServerForRel' value='<%=unixServerForRel%>'>
					<input type='hidden' name='unixServerUserid' value='<%=unixServerUserid%>'>
					<input type='hidden' name='unixServerPwd' value='<%=unixServerPwd%>'>
					<input type='hidden' name='hiddenrelname' value='<%=releaseName%>'>
					<td align='center'><input type=submit class=whitebutton name=downloadlogfilebutton  value="Get File" ></td>
					</tr>
					</form>
				<%  }
					
					}else{ %>	
						<tr bgcolor="#000077" >
							<td class=smallfonthead width="100%">
								<b>
									Release logs not Available, Kindly make sure that unix server, user and password are correct.
								</b>
							</td>
						</tr>	
					<%}%>
				
			</table>
		</form>

		<% }

///////









///////
				if(filterreportbutton.equals("Get Filter Report") || filterAction.equals("FilterAction")){
		%>
		<form name="FilterReportDisplayForm" action="ReleaseReport.jsp" method="post">
		
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid" colspan=8>
					<input type=hidden name=hiddenrelname value='<%=releaseName%>'>
					<input type=hidden name=filterAction value="FilterAction">
			
					<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=1 width="3%">
								<b>
									#
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="10%">
								<b>
									Database Name
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="10%">
								<b>
									Object Type
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="15%">
								<b>
									User Updated
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="30%">
								<b>
									Object Name / SQL Query
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="15%">
								<b>
									Contact Person
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="12%" nowrap="nowrap">
								<b>
									Date Updated
								</b>
							</td>
							<td class=smallfonthead colspan=1 width="5%">
								<b>
									CR Status
								</b>
							</td>
					</tr>	
				<tr bgcolor=#EFEFEF>
						<td class=bodyblue colspan=1 align="center" width="3%">
								&nbsp
						</td>
						<td class = bodyblue width="10%" colspan=1>
								<select name=ftr_dbname onChange="JavaScript:submitThisForReport()" >
								<option value='0' >- ALL -</option>
								<% 
									Vector dbType = dbutil.getDbNameVO();
									
									if(dbType!=null && dbType.size()>0){
									for(int i=0;i<dbType.size();i++)
									{
										DbNameVo dbvo =(DbNameVo)dbType.elementAt(i); 
								%>
	
										<option value= '<%=dbvo.getDBName()%>' 
										<%=ftr_dbname.equals(dbvo.getDBName())?"selected":"" %>	
											
											> 
											<%= dbvo.getDBName()%> </option>
					
								<%	} }
								%>
								</select>
						</td>
						<td class = bodyblue width="10%" colspan="1">
								<select name=ftr_objtype onChange="JavaScript:submitThisForReport()" >
								<option value='0' >- ALL -</option>
								<% 
									Vector objType = dbutil.getObjTypeVO();
									
									if(objType!=null && objType.size()>0){
									for(int i=0;i<objType.size();i++)
									{	
										ObjectTypeVO objvo =(ObjectTypeVO)objType.elementAt(i); 
								%>
	
										<option value= '<%=objvo.getObjType()%>' 
										<%=ftr_objtype.equals(objvo.getObjType())?"selected":"" %>	
											
											> 
											<%= objvo.getObjType()%> </option>
					
								<%	} }
								%>
								</select>
						</td>

						<td class = bodyblue width="15%" colspan="1">
								<select name=ftr_user onChange="JavaScript:submitThisForReport()" >
								<option value='0' >- ALL -</option>
								<% 
									Vector userList = dbutil.getUsersForRelease();
									
									if(userList !=null && userList.size()>0){
									for(int i=0;i<userList.size();i++)
									{	
										ReleaseVO uservo =(ReleaseVO)userList.elementAt(i); 
								%>
	
										<option value= '<%=uservo.getUserUpdated()%>' 
										<%=ftr_user.equals(uservo.getUserUpdated())?"selected":"" %>	
											
											> 
											<%= uservo.getUserUpdated()%> </option>
					
								<%	} }
								%>
								</select>
						</td>

						<td class=bodyblue align="right" width="60%" colspan=4>
							<input type=button class=whitebutton name="exportfilterbutton"  value="Export to Excel" onclick="exportToExcelForFilter()">
							<input type=button class=whitebutton name="exportcrnotebutton"  value="Rel CR Notes" onclick="exportToExcelForCR()">
						</td>

				</tr>

				<tr bgcolor=#EFEFEF>		
							<td class=bodyblue colspan=1 align="center" width="3%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="left" width="10%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="left" width="10%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="left" width="15%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="left" width="30%">
									&nbsp	
							</td>
							<td class=bodyblue colspan=1 align="left" width="15%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="center" width="12%">
									&nbsp
							</td>
							<td class=bodyblue colspan=1 align="center" width="5%">
									&nbsp
							</td>

					</tr>

	<!--
			</table>
			<table>
					<tr>
						<td> 
							&nbsp
						</td>
					</tr>
			</table>
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid" colspan=7>
	-->
				 <%
                     String objectnamedisplay = "";
					 String prevobjname = "";
					 int srno = 0;
					 String baccolor="";
					 if(FilterVector != null && FilterVector.size()>0){
					 for (int i=0;i<FilterVector.size();i++){	
						 ReleaseVO relvo = (ReleaseVO)FilterVector.elementAt(i);
						 if(i%2==0){
								baccolor="#C2D6EB";
								}
							else{ 
								baccolor="#EFEFEF";
								}
						 %>
						<tr bgcolor='<%=baccolor %>'>		
							<td class=bodyblue colspan=1 align="center" width="3%" height="18">
								
									<%=++srno%>
								
							</td>
							<td class=bodyblue colspan=1 align="center" width="10%">
								
									<%=relvo.getDBName()%>
								
							</td>
							<td class=bodyblue colspan=1 align="left" width="10%">
								
									<%=relvo.getObjType()%>
								
							</td>
							<td class=bodyblue colspan=1 align="left" width="15%">
								
									<%=relvo.getUserUpdated()%>
								
							</td>
							<% if(relvo.getValid().equals("N/A")){ %>
							<td class=bodyblue colspan=1 align="left" width="30%">
								
									<%=relvo.getObjName()%>
								
							</td>
							<%} else {%>
							<td class=bodyblue colspan=1 align="left" width="30%">

							<a href="javascript:overviewCRDetails('<%=relvo.getReleaseObjKey()%>')"><%=relvo.getObjName()%></a>

							<%}%>
							<td class=bodyblue colspan=1 align="left" width="15%">
								
									<%=relvo.getContactPerson()==null?"":relvo.getContactPerson()%>
								
							</td>
							<td class=bodyblue colspan=1 align="center" width="12%" nowrap="nowrap">
								
									<%=relvo.getDateUpdated()%>
								
							</td>
							<td class=bodyblue colspan=1 align="center" width="5%">
								
									<%=relvo.getValid()%>
								
							</td>

					</tr>
				<%			
					}}else{ %>	
						<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=8 width="100%">
								<b>
									Not any objects available for selected filter criteria.
								</b>
							</td>
						</tr>	
					<%}%>
									
			</table>
		</form>			

					
		<%			
		}




///////
		if(getdocbutton.equals("Get Documents")){
			%>
		
		<form name="ReleaseDocumentDisplay" action="ReleaseReport.jsp" method="post">
		
			<table cellpadding="0" cellspacing="1" width="100%" style="BORDER:#000000 1px solid">

			
					
					<%
					 if(ReleaseDocVector != null && ReleaseDocVector.size()>0) {

					%>
					
					<tr bgcolor="#000077" >
						<td class=smallfonthead colspan=1 width="5%">
							<b>
								#
							</b>
						</td>
						<td class=smallfonthead colspan=1 width="30%">
							<b>
								User 
							</b>
						</td>
						<td class=smallfonthead colspan=1 width="65%">
							<b>
								Documents Uploaded 
							</b>
						</td>
					</tr>	
						
					<%	int docsrno = 0;
					 for (int i=0;i<ReleaseDocVector.size();i++){	
						 ReleaseVO relvo = (ReleaseVO)ReleaseDocVector.elementAt(i);
							int relObjKey =	relvo.getReleaseObjKey();
							Properties property = new Properties();
							String filepath = new String();
							try {
									//File propfile = new File(System.getProperty("tracker.properties.home")+"/"+"STtracker.properties");
									//File propfile = new //File(getServletContext().getInitParameter("tracker.properties.home")+"/"+"STtracker.properties");
									//InputStream in = new FileInputStream(propfile);
									//property.load(in);
									filepath = objPropertyManager.getPropertyValue("DocumentPath");
							//		System.out.println("11111111111111111111111");
							}
							catch(Exception e) {
									System.out.println("in exception..LOADFILE>>>>>CONSTRUCTOR");
							}
							String path = filepath + "RelObjects/" + relObjKey ;
					//		System.out.println("PATH"+path);
							 File totalpath=new  File(path) ;
	 	
							if (totalpath.isDirectory()) 
							{
								File list[] = totalpath.listFiles();
								if(list.length >0 )
								{
									for(int j=0;j<list.length;j++){
										String filename =list[j].getName();
						%>
								<tr bgcolor=#EFEFEF>
									<td class=bodyblue colspan=1  align='center'><%=++docsrno %></td>
									<td class=bodyblue colspan=1  align='center'><%= relvo.getUserUpdated()%></td>
									<td class=bodyblue>
										<a href="openDocument.jsp?path=<%=path%>&filename=<%=filename%>" class=link > <%=filename%>
									</td >
								</tr>
						
						<%			}
								}
							}

						%>
				
				<% }}else{ %>	
						<tr bgcolor="#000077" >
							<td class=smallfonthead colspan=1 width="100%">
								<b>
									No Documents Available for selected Release.
								</b>
							</td>
						</tr>	
					<%}%>
				
			</table>
		</form>


		<% }
			%>
	</body>

</html>

<%}
			} catch (Exception e) {
				e.printStackTrace();
			}

		%>
